package com.aaa.service.impl;

import com.aaa.dao.BusinessDao;
import com.aaa.dao.impl.BusinessDaoImpl;
import com.aaa.service.BusinessService;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2021/7/19 9:56
 * @description：活动业务接口的实现类
 * @modified By：
 * @version: 1。0
 */
public class BusinessServiceImpl  implements BusinessService {
    BusinessDao businessDao = new BusinessDaoImpl();
    @Override
    public List<Map<String, Object>> findAllBusiness(Map map) {
        return businessDao.findAllBusiness(map);
    }
    @Override
    public int getCount(Map map) {
        return businessDao.getCount(map);
    }

    @Override
    public List<List<String>> getApplyCount() {
        List<List<String>>  countList= new ArrayList<>();
        List<Map<String, Object>> mapList = businessDao.getApplyCount();
        //加入第一行数据 ['product', '计划报名人数', '已经报名人数'],
        List<String> rowList= new ArrayList<>();
        rowList.add("product");
        rowList.add("计划报名人数");
        rowList.add("已经报名人数");
        countList.add(rowList);
        for (Map<String, Object> map : mapList) {
            List<String> tempList= new ArrayList<>();
            tempList.add(map.get("name").toString());
            tempList.add(map.get("planApply").toString());
            tempList.add(map.get("doneApply").toString());
            countList.add(tempList);
        }
        return countList;
    }

    @Override
    public boolean outlineBusinessById(Map map) {
        return businessDao.outlineBusinessById(map);
    }
}
